/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.geoviewer;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.beans.IntrospectionException;
import java.io.IOException;
import javax.swing.Action;
import org.openide.nodes.BeanNode;
import org.openide.nodes.Children;
import org.openide.util.Lookup;

/**
 *
 * @author Timon Veenstra
 */
public class LayerNode extends BeanNode<Layer> {

    //
    // data flavor for drag and drop support of layers
    //
    public static final DataFlavor DATA_FLAVOR = new DataFlavor(LayerNode.class, "LayerNode");    
    
    public LayerNode(Layer layer) throws IntrospectionException {
        super(layer);
        init();
       }

    public LayerNode(Layer layer, Children children, Lookup lkp) throws IntrospectionException {
        super(layer, children, lkp);
        init();
    }

    public LayerNode(Layer layer, Children children) throws IntrospectionException {
        super(layer, children);
        init();
    }

    public Layer getLayer() {
        return getBean();
    }

    private void init() {
        setIconBaseWithExtension("nl/cloudfarming/client/icon/Layers-icon-16.png");
    }

    @Override
    public Transferable drag() throws IOException {
        return super.drag();
    }

    @Override
    public Action[] getActions(boolean context) {
        return getBean().getActions();
    }

    
    
      
}
